<template>
  <div id="evaluateTop">
      <div class="left">
          <h3>{{overall_score}}</h3>
          <p>综合评分</p>
          <p>高于周边商家 {{Math.round((evaluation_list.compare_rating * 1000)) / 10}}%</p>
      </div>
      <div class="right">
          <div class="right-l">
              <p>服务态度</p>
              <p>菜品评价</p>
              <p>送达时间</p>
          </div>
          <div class="right-r">
            <div><van-rate v-model="food_score" :color="fontColor" :allow-half='true' readonly size="16" /> <span>{{service_score}}</span></div>
            <div><van-rate v-model="service_score" :color="fontColor" :allow-half='true' readonly size="16" /> <span>{{food_score}}</span></div>
            <div><i>{{deliver_time}}</i> 分钟</div>
          </div>
      </div>
  </div>
</template>

<script>
export default {
    data(){
        return {
            food_score: 0, // 菜品
            overall_score: 0, // 综合
            service_score: 0, // 服务
            deliver_time: 0, // 需要时间
            fontColor: "#fc6621"
        }
    },
    props: {
        evaluation_list: {
            type: Object,
            default: function(){
                return {}
            }
        }
    },
    mounted(){
        this.food_score = Math.round((this.evaluation_list.food_score * 10)) / 10;
        this.overall_score = Math.round((this.evaluation_list.overall_score * 10)) / 10;
        this.service_score = Math.round((this.evaluation_list.service_score * 10)) / 10;
        this.deliver_time = Math.round((this.evaluation_list.deliver_time * 10)) / 10;
    }
}
</script>

<style lang="less">
    #evaluateTop{
        margin-bottom: 20px;

        width: 100%;
        height: 220px;
        background-color: #fff;
        display: flex;
        flex-direction: row;
        justify-content: flex-start;

        /* 左侧div */
        .left{
            flex: 0.8;
            height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: space-around;
            align-items: center;
            font-size: 26px;

            /* 评分标题 */
            h3{
                margin-top: 14px;
                font-size: 60px;
                font-weight: bold;
                color: #fc6621;
            }
            p{
                color: #898989;
                &:nth-child(3){
                    padding-bottom: 12px;
                }
            }
        }
        /* 右侧div */
        .right{
            height: 100%;
            flex: 1;
            display: flex;
            flex-direction: row;
            justify-content: flex-start;
            padding: 15px 0;
            box-sizing: border-box;
            color: #898989;
            /* 右侧: 左边 */
            .right-l{
                width: 135px;
                height: 100%;
                display: flex;
                flex-direction: column;
                justify-content: space-around;
                font-size: 28px;
            }

            /* 右侧: 右边 */
            .right-r{
                height: 100%;
                display: flex;
                flex-direction: column;
                justify-content: space-around;
                font-size: 28px;
                span{
                    display: inline-block;
                    padding-left: 10px;
                    color: #fc6621;
                }

                i{
                    font-style: normal;
                }
            }
        }

    }
</style>